package com.supreme.secretserver;

import com.supreme.common.constant.ConsoleColors;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

import java.util.Map;

@SpringBootApplication
public class SupremeSecretServerApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(SupremeSecretServerApplication.class, args);
        System.out.println("\n\t\t \uD83D\uDE82 SupremeSecretServerApplication 启动完成 \uD83D\uDE82 \n");

        ConfigurableEnvironment environment = applicationContext.getEnvironment();
        String secretCommand = environment.getProperty("secret-server.secretCommand");
        ConsoleColors.printf(ConsoleColors.YELLOW_BOLD_BRIGHT, "secretCommand: " + secretCommand);

        System.out.println("========== SYSTEM ENV 0.0.1 ==========");
        Map<String, String> systemEnv = System.getenv();
        String javaHome = systemEnv.get("JAVA_HOME");
        System.out.println("javaHome = " + javaHome);
        String secretUsername = systemEnv.get("SECRET_USERNAME");
        System.out.println("secretUsername = " + secretUsername);
        String secretPassword = systemEnv.get("SECRET_PASSWORD");
        System.out.println("secretPassword = " + secretPassword);
        System.out.println("========== SYSTEM ENV 0.0.1 ==========");
    }

}
